<!---displays the categories--->
<cfinclude template = "../qry/qcategories.cfm">

<table width="196" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td align="left" class="blog_widget_titles">Categories</td>
  </tr>
  <tr>
    <td align="left">
		<cfloop query="qcategories">

        <cfquery name = "qblogsincategory" datasource="#request.dsn#">
        SELECT count(*) AS totalrecords FROM blog_posts
        WHERE cid = <cfqueryparam value="#qcategories.id#" cfsqltype="cf_sql_integer">
        <CFIF NOT pid IS 0>AND userid = <cfqueryparam value="#pid#" cfsqltype="cf_sql_integer"></CFIF>
        </cfquery>        
        
        <cfoutput>
			<div class="blog_categorydiv"><a class="blog_category" href = "index.cfm?m=blog&a=viewcategory&id=#id#&pid=#pid#">#qcategories.cname# (#qblogsincategory.totalrecords#)</a></div>
		</cfoutput>
		</cfloop>
		</td>
  </tr>
</table>










